package butines.game;

import butines.core.game.Vehicle;
import butines.core.game.steering.ArrivalBehavior;
import butines.core.game.steering.PriorityCombinationBehavior;
import butines.core.game.steering.SeekBehavior;
import butines.core.math.Vector2f;

public class Steering {

	private Vector2f steeringForce = new Vector2f();

	private PriorityCombinationBehavior prioritization;

	private SeekBehavior seek;
	private ArrivalBehavior arrival;
	
	public Steering(final Vehicle owner) {		
		seek = new SeekBehavior();
		seek.setSeeker(owner);

		arrival = new ArrivalBehavior();
		arrival.setSeeker(owner);
		arrival.setSlowingDistance(16f);

		prioritization = new PriorityCombinationBehavior(owner);

		prioritization.addBehavior(seek, 1f);
		prioritization.addBehavior(arrival, 1f);

	}
	
	public SeekBehavior getSeek() {
		return seek;
	}

	public ArrivalBehavior getArrivel() {
		return arrival;
	}

	public Vector2f calculate() {
		Vector2f calc = prioritization.calculate();
		steeringForce.set(calc);
		return steeringForce;
	}

	public Vector2f getSteeringForce() {
		return steeringForce;
	}

}